package com.wsx.first.b;

import org.junit.Test;

import java.util.Arrays;

/**
 * @author: wangshunxi
 * @date: 2022/5/7 14:15
 * @Description:
 */
public class Main0164 {

    @Test
    public void begin() {
        int[] nums = {3, 6, 9, 1};
        int gap = maximumGap(nums);
        System.out.println(gap);
    }

    public int maximumGap(int[] nums) {
        Arrays.sort(nums);
        System.out.println(Arrays.toString(nums));
        int[] p = new int[nums.length];
        Arrays.fill(p, -1);
        int max = 0;
        for (int i = 1; i < nums.length; i++) {
            max = Math.max(max, nums[i] - nums[i - 1]);
        }
        return max;
    }
}
